/**
@file
Contains ToUppercase and ToLowercase funcitons.

Version:
0.0.2

Last updated date:
2012-12-11

Created date:
2012-08-15
*/


#pragma once
#include <string>
#include "CString.h"



namespace Zaf {
namespace String {


/**
Converts a string to uppercase.

@param str %String to be converted.
*/
template<typename CharType>
void ToUppercase(std::basic_string<CharType>& str) {

	StrUpr(const_cast<CharType*>(str.c_str()), str.length() + 1);
}



/**
Returns a copy of a string converted to uppercase.

@param str %String to be converted.
@return The uppercase equivalent of \a str.
*/
template<typename CharType>
std::basic_string<CharType> ToUppercase(const std::basic_string<CharType>& str) {

	std::basic_string<CharType> result(str);
	ToUppercase(result);
	return result;
}



/**
Returns a copy of a c-style string converted to uppercase.

@param str C-style string to be converted.
@return The uppercase equivalent of \a str.
*/
template<typename CharType>
std::basic_string<CharType> ToUppercase(const CharType* str) {
	
	std::basic_string<CharType> result(str);
	ToUppercase(result);
	return result;
}



/**
Converts a string to lowercase.

@param str %String to be converted.
*/
template<typename CharType>
void ToLowercase(std::basic_string<CharType>& str) {

	StrLwr(const_cast<CharType*>(str.c_str()), str.length() + 1);
}

/**
Returns a copy of a string converted to lowercase.

@param str %String to be converted.
@return The lowercase equivalent of \a str.
*/
template<typename CharType>
std::basic_string<CharType> ToLowercase(const std::basic_string<CharType>& str) {

	std::basic_string<CharType> result(str);
	ToLowercase(result);
	return result;
}


/**
Returns a copy of a c-style string converted to lowercase.

@param str C-style string to be converted.
@return The lowercase equivalent of \a str.
*/
template<typename CharType>
std::basic_string<CharType> ToLowercase(const CharType* str) {

	std::basic_string<CharType> result(str);
	ToLowercase(result);
	return result;
}



} // String
} // Zaf